package com.itheima.sh.controller;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.itheima.sh.clients.UserFeignApi;
import com.itheima.sh.pojo.User;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("feign")

public class FeignController {

    @Autowired
    UserFeignApi userFeignApi;

    @GetMapping("{id}")
    public User queryById(@PathVariable("id") String username){
        User user = userFeignApi.queryByIdi(username);
        return user;
    }
}
